import { Component, OnInit } from '@angular/core';
import { Params, ActivatedRoute } from '@angular/router';
import { AuthService } from 'src/app/services/auth.service';
import * as constants from '../../../providers/Constants'
import { ToastService } from './../../../providers/toast/toast.service'
import { NavController } from '@ionic/angular';

@Component({
  selector: 'app-complain-add',
  templateUrl: './complain-add.page.html',
  styleUrls: ['./complain-add.page.scss'],
})
export class ComplainAddPage implements OnInit {
  content1:string='';
  constructor(private nav: NavController, private auth: AuthService, private toast: ToastService) {

  }
  ngOnInit() {
  }


  save() {
    this.auth.setUserSuggest({
      suggess: this.content1//1查常见问题 2查投诉
    }).subscribe(res => {
      // 保存成功返沪上一页，否则弹出提示框
      if (res.retCode == '000000') {
        // for (let index = 0; index < res.array.length; index++) {
        //   res.array[index].select=false;
        // }
        this.nav.pop();
      } else if (constants.errCode[res.retCode]) {
        if (constants.errCode[res.retCode] != '0') {
          this.toast.show(constants.errCode[res.retCode]);
        }
      } else if (res.retMsg) {
        this.toast.show(res.retMsg);
      } else {
        this.toast.show("exception service routine");
      }
    });
  }

}
